package ua.epam.java_bravo.data.dto;

import ua.epam.java_bravo.data.dto.pk.HsAddressPk;

import java.io.Serializable;

public class HsAddress implements Serializable {
    /**
     * This attribute maps to the column address_id in the HS_Address table.
     */
    protected long addressId;

    /**
     * This attribute maps to the column street in the HS_Address table.
     */
    protected String street;

    /**
     * This attribute maps to the column house in the HS_Address table.
     */
    protected int house;

    /**
     * This attribute maps to the column flat in the HS_Address table.
     */
    protected int flat;

    /**
     * This attribute represents whether the primitive attribute flat is null.
     */
    protected boolean flatNull = true;

    /**
     * Method 'HsAddress'
     */
    public HsAddress() {
    }

    /**
     * Method 'getAddressId'
     *
     * @return int
     */
    public int getAddressId() {
        return (int) addressId;
    }

    /**
     * Method 'setAddressId'
     *
     * @param addressId
     */
    public void setAddressId(long addressId) {
        this.addressId = addressId;
    }

    /**
     * Method 'getStreet'
     *
     * @return String
     */
    public String getStreet() {
        return street;
    }

    /**
     * Method 'setStreet'
     *
     * @param street
     */
    public void setStreet(String street) {
        this.street = street;
    }

    /**
     * Method 'getHouse'
     *
     * @return int
     */
    public int getHouse() {
        return house;
    }

    /**
     * Method 'setHouse'
     *
     * @param house
     */
    public void setHouse(int house) {
        this.house = house;
    }

    /**
     * Method 'getFlat'
     *
     * @return int
     */
    public int getFlat() {
        return flat;
    }

    /**
     * Method 'setFlat'
     *
     * @param flat
     */
    public void setFlat(int flat) {
        this.flat = flat;
        this.flatNull = false;
    }

    /**
     * Method 'setFlatNull'
     *
     * @param value
     */
    public void setFlatNull(boolean value) {
        this.flatNull = value;
    }

    /**
     * Method 'isFlatNull'
     *
     * @return boolean
     */
    public boolean isFlatNull() {
        return flatNull;
    }

    /**
     * Method 'equals'
     *
     * @param _other
     * @return boolean
     */
    public boolean equals(Object _other) {
        if (_other == null) {
            return false;
        }

        if (_other == this) {
            return true;
        }

        if (!(_other instanceof HsAddress)) {
            return false;
        }

        final HsAddress _cast = (HsAddress) _other;
        if (addressId != _cast.addressId) {
            return false;
        }

        if (street == null ? _cast.street != street : !street.equals(_cast.street)) {
            return false;
        }

        if (house != _cast.house) {
            return false;
        }

        if (flat != _cast.flat) {
            return false;
        }

        if (flatNull != _cast.flatNull) {
            return false;
        }

        return true;
    }

    /**
     * Method 'hashCode'
     *
     * @return int
     */
    public int hashCode() {
        long _hashCode = 0;
        _hashCode = 29 * _hashCode + addressId;
        if (street != null) {
            _hashCode = 29 * _hashCode + street.hashCode();
        }

        _hashCode = 29 * _hashCode + house;
        _hashCode = 29 * _hashCode + flat;
        _hashCode = 29 * _hashCode + (flatNull ? 1 : 0);
        return (int) _hashCode;
    }

    /**
     * Method 'createPk'
     *
     * @return HsAddressPk
     */
    public HsAddressPk createPk() {
        return new HsAddressPk((int) addressId);
    }

    /**
     * Method 'toString'
     *
     * @return String
     */
    public String toString() {
        StringBuffer ret = new StringBuffer();
        ret.append("ua.epam.java_bravo.data.dto.HsAddress: ");
        ret.append("addressId=" + addressId);
        ret.append(", street=" + street);
        ret.append(", house=" + house);
        ret.append(", flat=" + flat);
        return ret.toString();
    }

}
